// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
})

// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
  
  console.log('云函数被调用，参数：', event)
  
  return {
    success: true,
    message: '云函数调用成功！',
    data: {
      currentTime: new Date().toISOString(),
      userOpenId: wxContext.OPENID,
      userUnionId: wxContext.UNIONID,
      userAppId: wxContext.APPID,
      inputParams: event
    },
    timestamp: Date.now()
  }
} 